package se.hrbustrc.hlgshopping.controller;

import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import se.hrbustrc.hlgshopping.entity.User;
import se.hrbustrc.hlgshopping.service.UserService;
//Controller返回视图 ResController 返回Json
@RestController
@Tag(name = "用户管理",description = "用户管理")
@RequestMapping("/user")
public class UserController {
    @Autowired
    UserService userService;
    @Tag(name = "查询用户",description = "根据Id查询用户")
    @RequestMapping("/get/{id}")
    public User getUserById(@PathVariable("id") int id) {
        return userService.getUserById(id);
    }
    @RequestMapping("/add")
    public void addUser(User user) {
        userService.addUser(user);
    }



}
